package com.blb.zycommunity.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blb.zycommunity.entity.ZyCommunityInteraction;
import com.blb.zycommunity.mapper.ZyCommunityInteractionMapper;
import com.blb.zycommunity.service.IZyCommunityInteractionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 社区互动表 服务实现类
 * </p>
 *
 * @author chenheng
 * @since 2023-11-20
 */
@Service
public class ZyCommunityInteractionServiceImpl extends ServiceImpl<ZyCommunityInteractionMapper, ZyCommunityInteraction> implements IZyCommunityInteractionService {

    @Autowired
    private ZyCommunityInteractionMapper zyCommunityInteractionMapper;

    @Override
    public IPage<ZyCommunityInteraction> findCommunityInteractionPage(Long current, Long size, String ownerNickname, String ownerRealName, String ownerPhoneNumber, String communityId) {
        return zyCommunityInteractionMapper.selectCommunityInteractionPage(new Page<>(current,size),ownerNickname,ownerRealName,ownerPhoneNumber,communityId);
    }

    @Override
    public List<ZyCommunityInteraction> findCommunityInteractions(String communityId) {
        return zyCommunityInteractionMapper.selectCommunityInteractions(communityId);
    }

    @Override
    public void removeInteractionById(String interactionId) {
        zyCommunityInteractionMapper.deleteInteractionById(interactionId);
    }

    @Override
    public void addLikeNum(String interactionId) {
        zyCommunityInteractionMapper.addLikeNum(interactionId);
    }

    @Override
    public void removeLikeNum(String interactionId) {
        zyCommunityInteractionMapper.deleteLikeNum(interactionId);
    }
}
